package com.prototype.dao.impl;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import com.prototype.dao.AdminDAO;
import com.prototype.po.Admin;

/**
 * 管理员dao实现
 * 
 * @author eg366
 * 
 */
@Repository("adminDAO")
public class AdminDAOImpl extends BaseDAOImpl<Admin> implements AdminDAO {

	@Override
	public Class<Admin> getPersistentObject() {
		return Admin.class;
	}

	/**
	 * 根据登录名和密码查询Admin对象
	 */
	@Override
	public List<Admin> findByNamePwd(String loginName, String password) {
		DetachedCriteria criteria = DetachedCriteria.forClass(Admin.class);
		criteria.add(Restrictions.eq("loginName", loginName));
		criteria.add(Restrictions.eq("password", password));
		return this.findByCriteria(criteria);
	}

}
